﻿using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;

using ShootSearch.Core;
using ShootSearch.FileSystem;
using ShootSearch.Indexers;
using System.Xml.Serialization;

namespace ShootSearch.Jobs
{
    [Serializable]
    [TypeConverter(typeof(Util.ExpandableConverter<IndexBuilderJobConfig>))]
    public class IndexBuilderJobConfig : InputOutputJobConfig, IXmlSerializable
    {
        [XmlElement("Indexer")]
        [CategoryAttribute("Index"),
              DescriptionAttribute("Indexer setup")]
        public AssemblyWithConfig Indexer { get; set; }

        public IndexBuilderJobConfig():base()
        {
            Indexer = new AssemblyWithConfig();
        }



        #region IXmlSerializable Members

        public System.Xml.Schema.XmlSchema GetSchema()
        {
            return new System.Xml.Schema.XmlSchema();
        }

        public void ReadXml(System.Xml.XmlReader reader)
        {
            base.ReadFromXml(reader);
            Indexer = new AssemblyWithConfig();
            Indexer.ReadXml(reader);
        }

        public void WriteXml(System.Xml.XmlWriter writer)
        {
            base.WriteToXml(writer);
            Indexer.WriteXml(writer);
        }

        #endregion
    }
}
